

#ifndef TTIProgReq_BinarySearchTreeADTHeader_h
#define TTIProgReq_BinarySearchTreeADTHeader_h
#endif


#ifndef TTIPRogReq_HeaderFiles_h
#define TTIPRogReq_HeaderFiles_h
#include<stdio.h>
#include<vector>
#include<list>
#include<stdlib.h>
#include<iostream>
#include<exception>
#include<string.h>
#include<cmath>
#include<cstdlib>
#include<sstream>
using namespace std;
#endif

#ifndef TTIProgReq_BinarySearchTreeADTHeader_cpp
#define TTIProgReq_BinarySearchTreeADTHeader_cpp
#include "BinarySearchTreeADTOperations.cpp"
#endif



#ifndef NODE
#define NODE

struct node                       //Structure of a binary search tree.
{
    int info;
    node *left;
    node *right;
};
#endif

#ifndef DNODE
#define DNODE
struct dnode                     //Circular double linked list.
{
    int info;
    dnode *next;
    dnode *prev;
};
#endif

#ifndef LNODE
#define LNODE
struct lnode                     //Queue(for level order traversal).
{
    node *a;
    lnode *next;
};
#endif

#ifndef TTICProgReq_ExceptionHandlers_h
#define TTICProgReq_ExceptionHandlers_h

/* Exception handlers */
/* Handle the different kinds of exceptions */

class handleInvalidPerformOption: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid perform option (should be 'y' or 'n')";
    }
    virtual int code() const throw()
    {
        return -1;
    }
};


class handleInvalidPathSum: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid path-sum (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -2;
    }
};

class handleInvalidNSmallest: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid N (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -3;
    }
};

class handleInvalidDelete: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid delete element (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -4;
    }
};

class handleInvalidInsert: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid insert element (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -5;
    }
};

class handleInvalidInputCreateTree: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid number of elements (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -6;
    }
};


class handleInvalidMenuOption: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid menu option (should be a positive integer in the specified range)";
    }
    virtual int code() const throw()
    {
        return -7;
    }
};

class handleInvalidVectorArgument: public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Exception: Invalid Vector Size (should be a positive integer)";
    }
    virtual int code() const throw()
    {
        return -8;
    }
};


#endif

#ifndef TTICProgReq_FunctionDeclarations_h
#define TTICProgReq_FunctionDeclarations_h

/* Function Definitions */

void pathsum(node *root,int sumpath,int *found, int *sum);
node* mirror(node* root);
node* insert(node *root,int num);
node *findmin(node *s);
node* del(node *root,int num);
void preorder(node *root);
void inorder(node *root);
void postorder(node *root);
void levelorder(node *root,lnode *front,lnode *rear);
void NSmallest(node *root, int N, int *found, int *i);
void sum_leaves(node *root, int *sum);
int lmax(node *root,int height);
int min(int first,int second);
int lmin(node *root);
void findtype1(node *root,int *type);
void TreeToList(dnode *head,node *root);
node* clone (node *root);
void delete_tree(node* root);
void TreeToVector(node *root, vector<int> TreeVector[]);
void TreeToListSTL(node *root, list<int> TreeList[]);
node* VectorToTree(vector<int> VectorTree);
node* ListToTree(list<int> ListTree);
int TreeSize(node *root, int *size);
int menu();

#endif









